<script>
export default {
    name: 'Toast'
}
</script>
<script setup>
defineProps({
    value: {
        type: String,
        default: '',
    },
    type: {
        type: String,
        default: 'success'
    },
    duration: {
        type: Number,
        default: 2000
    }

})
</script>
<template>
    <div class="toast-box">
        <div class="toast-value" :class="type">
            <p> {{ value }}</p>
        </div>
    </div>
</template>
<style scoped lang="scss">
.toast-box {
    position: fixed;
    width: 100vw;
    height: 100vh;
    top: 0;
    left: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.toast-value {
    width: 185px;
    height: 222px;
    background: url(none) no-repeat center;
    background-size: 100%;
    display: block;
    animation: anim 0.5s;
    font-size: 26px;
    color: rgba(255, 255, 255, 0.7);
    text-align: center;
    padding: 144px 0 0;

    p {
        width: 95%;
        display: flex;
        align-items: center;
        justify-content: center;
        line-height: 26px;
        font-size: 16px;
        height: 52px;
        margin: 0 auto;
        color: rgba(255, 255, 255, 0.7)
    }

    &.success {
        background-image: url(../../assets/images/g6.png);
    }

    &.fail {
        background-image: url(../../assets/images/g3.png);

    }
}

@keyframes anim {
    0% {
        opacity: 0;
    }

    100% {
        opacity: 1;
    }
}

.toast-value.remove {
    animation: remove 0.5s;
}

@keyframes remove {
    0% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}
</style>